# $Id$
# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=archlinux-appstream-data
pkgver=20180821
pkgrel=1
pkgdesc="Arch Linux application database for AppStream-based software centers"
arch=(any)
url="http://www.archlinux.org"
license=(GPL)
depends=()
makedepends=()
source=()
noextract=()
for _repo in core extra community; do
 source+=($_repo-$pkgver.xml.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/Components-x86_64.xml.gz
          $_repo-icons-64x64-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/icons-64x64.tar.gz
          $_repo-icons-128x128-$pkgver.tar.gz::https://sources.archlinux.org/other/packages/$pkgname/$pkgver/$_repo/icons-128x128.tar.gz)
 noextract+=($_repo.xml.gz-$pkgver $_repo-icons-{64x64,128x128}-$pkgver.tar.gz)
done
sha256sums=('031af677f3990c7fc84874dae6c982d1afd40443e2b7b1744de866dab735fb9f'
            '7989bb311baa38ef545250282aa065d23281c46dfb8faabe4c653487bdbded5c'
            '7989bb311baa38ef545250282aa065d23281c46dfb8faabe4c653487bdbded5c'
            'c2caca383f4d366d7e0d4fab39b2e9c7a4a3b7fe93ca2e6e159d19a12d64cb40'
            '3841e228347f6021aee667045e5d0803b388d5a87a9ab28863f22f9479826cb1'
            '50ef6abbc9563cebc8ddea1722af00d20fe9efb9156d83d8f8ed3c9ce2e019bf'
            '5e945759231c8fd109c430207cf65ee85cff4b7c05ac081a980a0d79017baa76'
            '9da1788b402dece313a326c4b05efb8bc7b83e3d7cb6d83b6af104e49aff4ccb'
            'f5dda5b952c126cafb64302aa82acf64d7270d8ee85bb95b022d9814fda90b71')

package() {
  mkdir -p "$pkgdir"/usr/share/app-info/{icons/archlinux-arch-{core,extra,community}/{64x64,128x128},xmls}
  for _repo in core extra community; do
   tar -xzf $_repo-icons-64x64-$pkgver.tar.gz -C "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/64x64
   tar -xzf $_repo-icons-128x128-$pkgver.tar.gz -C "$pkgdir"/usr/share/app-info/icons/archlinux-arch-$_repo/128x128
   install -m644 $_repo-$pkgver.xml.gz "$pkgdir"/usr/share/app-info/xmls/$_repo.xml.gz
  done
}
